結算畫面
購物車=>總計=>跳轉結算畫面
訂購人資訊
產品資訊
CartController
訂單資料表
訂單主表
訂單詳細資訊
OrderHeader
public class OrderHeader
{
public int Id { get; set; }
public string ApplicationUserId { get; set; }
[ForeignKey("ApplicationUserId")]
[ValidateNever]
public ApplicationUser ApplicationUser { get; set; }
[Required]
public DateTime OrderDate { get; set; }
public double OrderTotal { get; set; }
public string? OrderStatus { get; set; }
public string? PaymentStatus { get; set; }
public DateTime PaymentDate { get; set; }
public DateTime PaymentDueDate { get; set; }
public string? SessionId { get; set; }
[Required]
public string PhoneNumber { get; set; }
[Required]
public string Address { get; set; }
[Required]
public string Name { get; set; }
}
public class OrderDetail
{
public int Id { get; set; }
[Required]
public int OrderHeaderId { get; set; }
[ForeignKey("OrderHeaderId")]
[ValidateNever]
public OrderHeader OrderHeader { get; set; }
[Required]
public int ProductId { get; set; }
[ForeignKey("ProductId")]
[ValidateNever]
public Product Product { get; set; }
public int Count { get; set; }
public double Price { get; set; }
public string Color { get; set; }
public string Size { get; set; }
}
public DbSet<OrderHeader> OrderHeaders { get; set; }
public DbSet<OrderDetail> OrderDetails { get; set; }
public IOrderHeaderRepository OrderHeader { get; private set; }
public IOrderDetailRepository OrderDetail { get; private set; }
OrderHeader = new OrderHeaderRepository(_db);
OrderDetail = new OrderDetailRepository(_db);
IOrderHeaderRepository OrderHeader { get; }
IOrderDetailRepository OrderDetail { get; }